# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : zsj.py
# @Time     : 2024/4/21 22:16
# @Author   : Robot-Zsj
"""
description:

i:
2
REQUEST=10
REQUEST=20

o:
0
10
"""
n = int(input())
cmds = [input().split("=") for _ in range(n)]


def hasIntersection(a1, a2):
    s1, e1 = a1
    s2, e2 = a2
    if s1 == s2:
        return True
    elif s1 < s2:
        return e1 >= s2
    else:
        return e2 >= s1


def getResult():
    used = [[100, 101]]

    for key, val in cmds:
        if key == "REQUEST":
            size = int(val)

            if size == 0:
                print("error")
                continue

            start = 0
            flag = True
            for i in range(len(used)):
                end = start + size - 1

                ran = [start, end]

                if not hasIntersection(used[i], ran):
                    used.insert(i, ran)
                    flag = False
                    print(start)
                    break
                else:
                    start = used[i][1] + 1
            if flag:
                print("error")
        else:
            addr = int(val)

            if addr >= 100:
                print("error")
                continue

            flag = True

            for i in range(len(used)):
                if used[i][0] == addr:
                    used.pop(i)
                    flag = False
                    break

            if flag:
                print("error")


getResult()
